//
//  HomeRecommendHightQualityView.swift
//  HomeRecommendHightQualityView
//
//  Created by Ben on 2021/8/19.
//

import SwiftUI


struct HomeRecommendHightQualityView: View {
    var body: some View {
        VStack {
            
            // title、说明、更多按钮
            HStack {
                Text("闲鱼优品")
                    .font(.system(size: 18, weight: .semibold))
                
                // 品质保证说明
                HStack(spacing: 4) {
                    HomeRecommendHightQualityExplainView(title: "100%验货包真")
                    Divider()
                        .background(Color.black.opacity(0.5))
                        .frame(width: 1, height: 10)
                    HomeRecommendHightQualityExplainView(title: "全国包邮")
                        .font(.system(size: 10, weight: .semibold))
                        .foregroundColor(Color.black.opacity(0.8))
                    
                    Divider()
                        .background(Color.black.opacity(0.5))
                        .frame(width: 1, height: 10)
                    HomeRecommendHightQualityExplainView(title: "品牌包退")
                        .font(.system(size: 10, weight: .semibold))
                        .foregroundColor(Color.black.opacity(0.8))
                    
                }
                .padding(4)
                .background(
                    RoundedRectangle(cornerRadius: 4)
                        .fill(Color(hex: 0xFCE5C3))
                )
                
                Spacer(minLength: 0)
                
                Button {
                    Dlog("查看更多")
                } label: {
                    HStack(spacing: 0) {
                        Text("更多")
                        
                        Image(systemName: "chevron.right")
                    }
                    .font(.system(size: 10))
                    .foregroundColor(Color.black.opacity(0.4))
                    .padding(4)
                    .background(
                        Capsule().fill(.white)
                    )
                }
                
            }
            
            // 优品推荐分类
            HStack(alignment: .top) {
                HomeRecommendHightQualityCategoryView(categoryIconName: "home_re_category_phone", categoryTitle: "精品手机", categoryDoc: "一年质保")
                HomeRecommendHightQualityCategoryView(categoryIconName: "home_re_category_baobao", categoryTitle: "奢品捡漏", categoryDoc: "低价保真")
                HomeRecommendHightQualityCategoryView(categoryIconName: "home_re_category_jacket", categoryTitle: "潮鞋潮服", categoryDoc: "正品尖货")
                HomeRecommendHightQualityCategoryView(categoryIconName: "home_re_category_meizhuang", categoryTitle: "折扣美妆", categoryDoc: "低至9.9")
                
            }
        }
    }
}


struct HomeRecommendHightQualityExplainView: View {
    
    var title: String
    var body: some View {
        Text(title)
            .font(.system(size: 10, weight: .semibold))
            .foregroundColor(Color.black.opacity(0.8))
    }
}


